package com.woniuxy.propertyjava.service.impl;

import com.woniuxy.propertyjava.dao.LifeserviceDao;
import com.woniuxy.propertyjava.entity.Lifeservice;
import com.woniuxy.propertyjava.entity.PageBean;
import com.woniuxy.propertyjava.service.LifeserviceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class LifeserviceServiceImpl implements LifeserviceService {
    @Resource
    LifeserviceDao lifeserviceDao;
    @Override
    public PageBean<Lifeservice> getLifeserviceByPage(int pageIndex, int pageSize, Lifeservice lifeservice) {
        PageBean<Lifeservice> pageBean=new PageBean<>();
        pageBean.setPageIndex(pageIndex);
        pageBean.setPageSize(pageSize);
        pageBean.setBeanList(lifeserviceDao.selectLifeserviceByPage(pageIndex, pageSize, lifeservice));
        pageBean.setTotalRecode(lifeserviceDao.selectLifeserviceByPageCount(lifeservice));
        return pageBean;
    }

    @Override
    public int getLifeserviceByPageCount(Lifeservice lifeservice) {
        return lifeserviceDao.selectLifeserviceByPageCount(lifeservice);
    }

    @Override
    public void insertLifeservice(Lifeservice lifeservice) {
         lifeserviceDao.insertLifeservice(lifeservice);
    }

    @Override
    public void deletLifeservice(int serviceid) {
         lifeserviceDao.deletLifeservice(serviceid);
    }

    @Override
    public void updateLifeservice(Lifeservice lifeservice) {
            lifeserviceDao.updateLifeservice(lifeservice);
    }
}
